//
//  CTVMediaDownloadController.h
//  Channltv
//
//  Created by Bruno Keymolen on 29/08/07.
//  Copyright 2007 channl.tv. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "CTVClip.h"
#import "CTVChannel.h"
#import "CTVHTTPMediaDownload.h"
#import "CTVDownloadController.h"


@interface CTVMediaDownloadController : BRLayerController <BRMediaPreviewController, CTVMediaDownloadUpdate> {
	BRImageControl *_image;
	CTVHTTPMediaDownload* m_downloader;
	CTVDownloadController* m_progressBarContoller; 
	BRButtonControl* m_abortButton;
	BRButtonControl* m_okButton;	
	NSString* m_title;
	long m_filesize;
	NSString* m_urlString;
	CTVClip* m_clip;
	CTVChannel* m_channel;
	BOOL m_playClipNow;
	BOOL m_skipClip;

	NSTimer* m_timer;
	BOOL m_playNextChannel;
	BOOL m_playPrevChannel;
	
}

- (id)initWithScene: (BRRenderScene *) scene  andClip:(CTVClip*)clip andImage:(CGImageRef)img andMediaDownload:(CTVHTTPMediaDownload*)mediaDownload andTitle:(NSString*)title forChannel:(CTVChannel*)channel;

- (id)layer;
- (void)activate;
- (void)willLoseFocus;
- (void)willRegainFocus;
- (void)willDeactivate;
- (void)deactivate;
- (BOOL)fadeLayerIn;
- (void)setDeletterboxAssetArtwork:(BOOL)fp8;

- (id)popAnimation;
- (id)pushAnimation;
- (BOOL)brEventAction:(BREvent*)event;

-(void)abortClipDownload;
-(void)finishClipDownload;
-(void)playClipDownload;


-(BOOL)playChannelNext;
-(BOOL)playChannelPrev;

-(void)_timerCloseHandler:(NSTimer*)timer;


//CTVMediaDownloadUpdate
-(void)downloadPercent:(int)pc;
-(void)downloadTimeLeft:(int)tl;
-(void)downloadFinish;
-(void)downloadError:(int)errorcode;
-(BOOL)playClipNow;
-(BOOL)skipClip;

@end
